A staircase graph using matplotlib
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')
y = [7.5, 5.7, 3.5, 2.8, 3.9, 6.6, 2.9, 8.5, 3.7]
fig, ax = plt.subplots()
ax.stairs(y, linewidth=2.5)
ax.set(xlim=(0, 10), xticks=np.arange(1, 10),
ylim=(0, 10), yticks=np.arange(1, 10))
plt.show()
Contour(X, Y, Z) graph using matplotlib
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery-nogrid')
# make data
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
Z = (1 - X/4 + X**3 + Y**2) * np.exp(-X**2 - Y**2)
levels = np.linspace(np.min(Z), np.max(Z), 7)
# plot
fig, ax = plt.subplots()
ax.contour(X, Y, Z, levels=levels)
plt.show()
Bubble chart using Plotly
import plotly
plotly.offline.init_notebook_mode()
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp",
size="pop", color="continent",
hover_name="country", log_x=True, size_max=40)
fig.show()
Conditional kernel density estimate using Seaborn
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the diamonds dataset
diamonds = sns.load_dataset("diamonds")
# Plot the distribution of clarity ratings, conditional on carat
sns.displot(
data=diamonds,
x="carat", hue="cut",
kind="kde", height=4,
multiple="fill", clip=(0, None),
palette="ch:rot=-.25,hue=1,light=.75",
)
<seaborn.axisgrid.FacetGrid at 0x2c21722ffd0>